import { NavigationMenu, Floor } from '@/api/index.js' // 导入home中的api数据源

// 数据源
const state = {
  // 三级联动导航菜单数据源
  navigationMenu: '',
  // floor 楼层数据源
  floor: ''
}
// 修改 state 数据源
const mutations = {
  navigationMenu(state, Value) {
    state.navigationMenu = Value
  },
  floor(state, Value) {
    state.floor = Value
  }
}

// 异步函数，书写业务
const actions = {
  async navigationMenu(state) {
    let result = await NavigationMenu()
    state.commit('navigationMenu', result)
  },

  async floor(state) {
    let result = await Floor()
    state.commit('floor', result.data)
  }
}

// 计算属性
const getters = {}

// 向外共享函数
export default {
  state,
  mutations,
  actions,
  getters
}
